home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / graphicgems4.lha / GemsIV / ptpoly_haines / table.awk < prev   
Encoding:
AWK Script  |  1995-02-06  |  1.1 KB  |  65 lines

  1. # Run results from statrun.tst through this script, e.g.
  2. #    table.awk *.stats
  3. # to generate tables of timings
  4.  
  5. for dog in $*
  6. do
  7. cat $dog | awk '
  8. BEGIN {
  9.     count = -1
  10. }
  11. {
  12.     if ( $1 == "Polygons" ) {
  13.     count++
  14.     if ( !count ) {
  15.         title = $0
  16.         title_on = 1
  17.     }
  18.     if ( $4 == "to" ) {
  19.         nv[count] = $3"-"$5
  20.     } else {
  21.         nv[count] = $3
  22.     }
  23.     } else if ( title_on ) {
  24.     if ( !count ) {
  25.         if ( $1 == "Testing" ) {
  26.         title_on = 0
  27.         } else {
  28.         title = title "\n" $0
  29.         }
  30.     }
  31.     } else if ( $3 == "time:" ) {
  32.     t[$1,count] = $4
  33.     found[$1] = 1
  34.     } else if ( $2 == "%" ) {
  35.     pc[count] = $1
  36.     }
  37. }
  38. END {
  39.     print title
  40.  
  41.     printf( "\n\t\t   Number of vertices\n\t" )
  42.     for ( i = 0 ; i <= count ; i++ ) {
  43.     printf( "\t    %s",nv[i] )
  44.     }
  45.     printf( "\n\n" ) ;
  46.  
  47.     for ( name in found ) {
  48.     printf( "%s\t", name )
  49.     if ( length( name ) < 8 ) {
  50.         printf( "\t" )
  51.     }
  52.     for ( i = 0 ; i <= count ; i++ ) {
  53.         printf( "%8.1f",t[name,i] )
  54.     }
  55.     printf( "\n" ) ;
  56.     }
  57.  
  58.     printf( "\ninside %\t" )
  59.     for ( i = 0 ; i <= count ; i++ ) {
  60.     printf( "%8.1f",pc[i] )
  61.     }
  62.     printf( "\n\n\n" ) ;
  63. }'
  64. done
  65.